<%@ page language="java" pageEncoding="UTF-8" import="com.chinapost.util.AuthUtil"%>
<%@ taglib prefix="my" uri="/WEB-INF/tlds/permission.tld" %>
<%
	AuthUtil authUtil = new AuthUtil(session);
%>
<script type="text/javascript">
var yxsjTjfy_datagrid;
$(function ()
{
    yxsjTjfy_datagrid = $('#yxsjTjfy_manager_datagrid').datagrid(
        {
            url : '${pageContext.request.contextPath}/yxsjAction!tjfy_datagrid.action',
            pagination : true,
            pageSize : 20,
            pageList :  [  10, 20, 30, 40, 50 ],
            border : false,
            fit: true,
            fitColumns: true,
            idField : 'cid',
            sortName : 'cbh',
            sortOrder : 'asc',
            checkOnSelect : false,
            selectOnCheck : true,
            columns : [[
                    {
                        title : '部门名称',
                        field : 'deptname',
                        align : "center",
                        width : 120
                    },
                    {
                        title : '用户编号',
                        field : 'cbh',
                        align : "center",
                        width : 80
                    },
                    {
                        title : '用户名',
                        field : 'username',
                        align : "center",
                        width : 80
                    },
                    {
                        title : '营销总积分',
                        field : 'czjf',
                        align : "center",
                        width : 120
                    },
                    {
                        title : '奖励合计',
                        field : 'cjh',
                        align : "center",
                        width : 120
                    }
                ]]
        }
        );
    $('#yxsjTjfy_manager_dept').val('${sessionInfo.deptid}');
}
);



function _searchYxsjTjfy() {
	var smonth=$('#yxsjTjfy_startMonth').val();
	var emonth=$('#yxsjTjfy_endMonth').val();
	if (smonth.length >0 && emonth.length >0){
		if(smonth.substring(0,4)==emonth.substring(0,4)){
			yxsjTjfy_datagrid.datagrid('load', sy.serializeObject($('#yxsjTjfy_search_form')));
			yxsjTjfy_datagrid.datagrid('uncheckAll').datagrid('unselectAll').datagrid('clearSelections');
		}else{
			parent.sy.messagerAlert('提示', '起始月份和结束月份必须在同一年！', 'error');
		}
	}else{
		parent.sy.messagerAlert('提示', '请选择起始月份和结束月份！', 'error');
	}
};

function export_yxsjTjfy() {
	var smonth=$('#yxsjTjfy_startMonth').val();
	var emonth=$('#yxsjTjfy_endMonth').val();
	if (smonth.length >0 && emonth.length >0){
		if(smonth.substring(0,4)==emonth.substring(0,4)){
			 url='${pageContext.request.contextPath}/yxsjAction!exportExcel_tjfy.action';
			 $('#yxsjTjfy_search_form').attr('action',url);
		     $('#yxsjTjfy_search_form').submit();
		}else{
			parent.sy.messagerAlert('提示', '起始月份和结束月份必须在同一年！', 'error');
		}
	}else{
		parent.sy.messagerAlert('提示', '请选择要导出数据的起始月份和结束月份！', 'error');
	}
}
</script>

<div class="easyui-layout" data-options="fit:true" style="overflow: hidden;">
	<div data-options="region:'north',title:'查询导出',iconCls:'icon-search'" style="height: 80px;padding:5px;overflow: hidden;">
		<div style="padding:5px">
			<form method="post" id="yxsjTjfy_search_form" style="display:inline">
			<span>所属单位：</span>
			<input id="yxsjTjfy_manager_dept" class="easyui-combotree" name="deptid" data-options="lines:true,url:'deptAction!do_combotree.action',panelHeight:280,required:true,editable:false,idField:'id',textField:'text',parentField:'pid'" style="width:150px"/>&nbsp;
			<span>人员编号：</span>
			<input type='text' id="yxsjTjfy_manager_userbh" name='cbh' style="width:80px" />&nbsp;&nbsp;
			<span>开始月份：</span>
			<input class="easyui-my97" type="text" id="yxsjTjfy_startMonth" name="startMonth"  data-options="dateFmt:'yyyyMM'" style="width:80px"/>&nbsp;
			<span>结束月份：</span>
			<input class="easyui-my97" type="text" id="yxsjTjfy_endMonth" name="endMonth"  data-options="dateFmt:'yyyyMM'" style="width:80px"/>&nbsp;
			</form>
			<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-search'" onclick="_searchYxsjTjfy();">查询</a>
			<a href="javascript:void(0)" class="easyui-linkbutton" data-options="iconCls:'icon-excel'" onClick="export_yxsjTjfy();;">导出</a>
		</div>
	</div>
	<div data-options="region:'center',title:'数据列表',border:true,iconCls:'icon-menu'" style="overflow: hidden;">
		<table id="yxsjTjfy_manager_datagrid"></table>
	</div>
</div>
